import java.util.Scanner;

/**
 * Created With IntelliJ IDEA
 * Description:牛客网:WY24 洗牌
 * <a href="https://www.nowcoder.com/practice/5a0a2c7e431e4fbbbb1ff32ac6e8dfa0?tpId=85&&tqId=29848&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking">...</a>
 * User: DELL
 * Data: 2023-04-18
 * Time: 21:43
 */


public class Main {
    //这个题可以用递归写，但是没有必要，用递归写空间复杂度会很高，不如直接洗 k 次。
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        while (T-- != 0) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int[] cards = new int[2 * n];
            for (int i = 0; i < 2 * n; i++) {
                cards[i] = scanner.nextInt();
            }
            while (k-- != 0) {
                cards = shuffle(cards, n);
            }
            //打印洗好的牌
            for (int i = 0; i < 2 * n - 1; i++) {
                System.out.print(cards[i] + " ");
            }
            System.out.println(cards[2 * n - 1]);
        }
    }

    /**
     * 洗一次牌 （洗的时候直接将牌逆序一下，因为题目中要从上往下读）
     * @param cards    牌
     * @param mid      一半牌的数量
     * @return         洗过的牌
     */
    private static int[] shuffle(int[] cards, int mid) {
        int[] newCards = new int[2 * mid];
        int index = 2 * mid - 1;
        for (int i = mid - 1; i >= 0; i--) {
            //右手的牌
            newCards[index--] = cards[mid + i];
            //左手的牌
            newCards[index--] = cards[i];
        }
        return newCards;
    }
}
